/*
 * txdnet.cn tonydon
 * by netbeans ide 7.2
 */
package cn.txdnet.txcms.view.action;

import cn.txdnet.txcms.service.HotWordService;
import cn.txdnet.txweb.model.ModelUtil;
import cn.txdnet.txweb.model.ModelView;
import cn.txdnet.txweb.utils.WebUtil;
import javax.servlet.http.HttpServletRequest;

/**
 *
 * @author tangxiaodong
 */
public class HotWordAction {
    
    /**
     * 读取某类目下的热词
     * @param req
     * @return 
     */
    public ModelView query_list(HttpServletRequest req){
        int cid = WebUtil.getInt(req, "cid", -1);
        int cr = WebUtil.getInt(req, "cr", 0);
        int listsize = WebUtil.getInt(req, "ls", 20);
        return ModelUtil.getJsonModel(HotWordService.queryListForView(cid, cr, listsize));
    }
    
    /**
     * 更新热词点击数
     * @param req 
     */
    public void hit_num(HttpServletRequest req){
        long id = WebUtil.getLong(req, "id", -1);
        if(id>0){
            HotWordService.increaseHitNum(id);
        }
    }
}
